package com.clouddot.baipai.ui.adapter.V_Adapter;

import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.clouddot.baipai.R;
import com.clouddot.baipai.infrastructure.environment.Env;
import com.clouddot.baipai.model.beam.PRaise.PRaiseResponse;

import java.util.List;

/**
 * Created by wxy on 2018/8/26.
 */

public class PRaiseAdapter extends BaseMultiItemQuickAdapter<PRaiseResponse,BaseViewHolder> {

    private List<PRaiseResponse> mData;

    public PRaiseAdapter(List<PRaiseResponse> mDataList) {
        super(mDataList);

        addItemType(PRaiseResponse.pRaiseTop, R.layout.h_adapter_praise_item);
        addItemType(PRaiseResponse.pRaiseTwo, R.layout.h_adapter_praiseother_item);
        mData = mDataList;
    }

    @Override
    protected void convert(BaseViewHolder helper, final PRaiseResponse item) {

        switch (item.getItemType()) {
            case PRaiseResponse.pRaiseTop:
                helper.setText(R.id.name,item.getName());
                helper.setText(R.id.date,item.getDate());
                helper.setText(R.id.week,item.getWeek());
                helper.setText(R.id.praiseInfo,item.getInfo());
                break;
            case PRaiseResponse.pRaiseTwo:
                helper.setText(R.id.name,item.getName());
                helper.setText(R.id.praiseInfo,item.getInfo());
                break;
            default:
                break;
        }


        Glide.with(Env.getContent()).load(Env.getAppContext().IP+item.getPhoto()).error(R.drawable.img_02).into((ImageView) helper.convertView.findViewById(R.id.photo));
        Glide.with(Env.getContent()).load(Env.getAppContext().IP+item.getIcon()).error(R.drawable.img_02).into((ImageView) helper.convertView.findViewById(R.id.icon));








    }


}
